<?php

include("global.php");

$pagetitle=" - Administration - Ban list";
$links=" > Administration > Ban list";

include ("header.php");

include ("admin_header.php");

if($userloggedinarray[15]!=="administrator"){
   unset($tplcontent);
   $tplcontent['notice']="Must be logged in as administrator to use control panel!";
   echo template('notice',$tplcontent);
}else{

 if(!$editbanlist){
 unset($tplcontent);

 $tplcontent['formheader'].="<form action=\"admin_banlist.php\" method=post>";
 $tplcontent['formheader'].="<input type=hidden name=\"editbanlist\" value=\"1\" size=40>";

 $tplcontent['banlist'].="<textarea name=\"banlist\" cols=40 rows=10 class=\"forminput\">";
 for($n=0;$n<count($banarray);$n++){
 $tplcontent['banlist'].="$banarray[$n]\n";
 }
 $tplcontent['banlist'].="</textarea>";
 
 $tplcontent['submitbutton'].="<input type=submit name=\"submit\" value=\"Update\" class=\"formbutton\">";
 $tplcontent['formfooter'].="</form>";
 
 echo template('adminbanlist',$tplcontent);
 }

 if($editbanlist){

 $banlist=explode("\n",$banlist);
 @unlink("$configarray[1]/ban.php");
 
 for($n=0;$n<count($banlist);$n++){
  writedata("$configarray[1]/ban.php",$banlist[$n],$n);
 }

   unset($tplcontent);
   $tplcontent['notice']="Ban list updated!";
   echo template('notice',$tplcontent);
 }

}//access check
include("admin_footer.php");

include("footer.php");

?>
